package com.usian.search.controller;

import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.search.dtos.UserSearchDto;
import com.usian.search.SearchControllerApi;
import com.usian.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article/search")
public class SearchController implements SearchControllerApi {

    @Autowired
    private SearchService searchService;

    /**
     * 搜索文章
     *
     * @param dto
     * @return
     */
    @PostMapping("search")
    @Override
    public ResponseResult search(UserSearchDto dto) {
        return searchService.search(dto);
    }
}
